import request from '@/utils/request'

// 查询渠道列表
export function listChannel(query) {
  return request({
    url: '/admin/channel/list',
    method: 'get',
    params: query
  })
}
// 查询所有渠道(不分页)
export function listAllChannel(query) {
  return request({
    url: '/admin/channel/channelList',
    method: 'get',
    params: query
  })
}
// 查询渠道列表-不分页
export function searchChannel(query) {
  return request({
    url: '/admin/channel/search',
    method: 'get',
    params: query
  })
}

// 查询渠道详细
export function getChannel(configId) {
  return request({
    url: '/admin/channel/' + configId,
    method: 'get'
  })
}

// 新增渠道
export function addChannel(data) {
  return request({
    url: '/admin/channel/save',
    method: 'post',
    data: data
  })
}

// 修改渠道
export function editChannel(data) {
  return request({
    url: '/admin/channel/update',
    method: 'put',
    data: data
  })
}

export function getChannelConfig(id) {
  return request({
    url: '/admin/channel/config/' + id,
    method: 'get'
  })
}
// 修改渠道
export function updateChannelConfig(data) {
  return request({
    url: '/admin/channel/config/update',
    method: 'put',
    data: data
  })
}

// 删除渠道
export function delChannel(configId) {
  return request({
    url: '/admin/channel/remove/' + configId,
    method: 'delete'
  })
}

